import pageination from '../../components/pageination/pageination.vue'
export default {
	data() {
		return {
			//数据
			total: 0, //总条数
			page: 1, //当前页
			size: 10,//每页显示条数
			fatherIndex: 0, //一级菜单index
      graduationList: [] //结业列表
		}
	},
	components: {
		pageination
	},
	created() { //调用方法
    //初始化当前证书分页信息
    //this.searchTodo();
	},
	mounted() {
	},
	updated:function(){
		if(this.getParamValue("fatherIndex")){
			this.fatherIndex=this.getParamValue("fatherIndex");
		}
	},
	methods: { //写函数方法
		//页码切换执行方法
		pageFn: function(val, pid) {
			this.page = parseInt(val);
			//此处调列表数据接口
			this.searchTodo(pid); //查询新闻
		},
		/**返回子组件用户选择的一页显示条数**/
		obtainChild: function(data) {
			this.row = data;
		},
    //搜索数据列表
    searchTodo: function() {
      let that = this;
      that.$post(
        that.urls.getCurrentStudentGraduationPageInfo,
        {"haveCertificate": true,"pageNum": that.page,"pageSize": that.size}
      )
      .then(function(res) {
        if(res.success) {
          that.graduationList = res.pageInfo.list;
          that.total = res.pageInfo.total;
          that.page = res.pageInfo.pageNum;
        }
      })
    },
		//进入课程详情页
		CourseDetails:function(){
			this.$router.push({
				path: "/courseDetails?fatherIndex="+this.fatherIndex,
			})
		},
    //下载资源
    downloadResources: function(filePath) {
      if(filePath != null && filePath != "") {
        window.location.href = this.urls.download + "?path=" + filePath;
      } else {
        layer.msg("暂无结业证书！", {
          time: 3000, //3s后自动关闭
        });
      }
    }
	}
}
